<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获取鼠标点击位置</title>
</head>
<body>
    <h1>点击页面获取鼠标位置</h1>
    <p id="coordinates"></p>

    <script>
        document.addEventListener('click', function(event) {
            const x = event.clientX; // 鼠标点击的 X 坐标
            const y = event.clientY; // 鼠标点击的 Y 坐标
            document.getElementById('coordinates').textContent = `鼠标位置: (${x}, ${y})`;
        });
    </script>
</body>
</html>